<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">

    <title>神象农业系统</title>
    <link rel="stylesheet" href="${basePath}/adminlte/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="${basePath}/common/libs/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="${basePath}/common/css/style.css" rel="stylesheet">
    <link rel="stylesheet" href="${basePath}/common/css/login.css" rel="stylesheet">

</head>

<body class="signin" style="color:#000;">

<#include "common/modal.html" />
<#include "common/entity.html" />

<div class="signinpanel" style="color:rgba(255,255,255,.95)">
    <div class="row">
        <div class="col-sm-7">
            <div class="signin-info">
                <div class="logopanel m-b">
                    <h1>神象农业系统</h1>
                </div>
                <br>
                <div class="m-b"></div>
                <h4>欢迎来到<strong>神象农业系统</strong></h4>
            </div>
        </div>
        <div class="col-sm-5">
            <form class="loginForm">
                <head>
                    <span style="display:inline;margin:0;padding:0"><strong>登陆:</strong></span>
                </head>
                <p class="m-t-md">登录到你的神象农业系统账号</p>
                <p class="m-t-md" id="error" style="color:red;"></p>
                <input name="username" type="text" class="form-control uname m-b" placeholder="用户名" required="true"/>
                <input name="password" type="password" class="form-control pword m-b" placeholder="密码" required="true"/>
                <!--<input name="imageCode" type="text" class="form-control m-b" placeholder="验证码" required="true" style="display:inline-block;color:#000;width:50%;"/>
                <img src="${basePath}/loginAndRegister/code/image" alt="" style="display:inline-block;cursor:pointer;">-->
                <div class="checkbox">
                    <label class="pull-left"><input type="checkbox" id="save" style="transform: translateY(50%);"/>记住我</label>
                    <a href="javascript:void(0);" id="forgetPassword"
                       style="cursor:pointer;text-decoration:none;float: right;padding:7px 0px;">忘记密码</a>
                </div>
                <button type="button" id="login" class="btn btn-success btn-block">登录</button>

            </form>
        </div>
    </div>
    <div class="signup-footer">
        <div class="pull-left">
            &copy; 2015 All Rights Reserved.
        </div>
    </div>
</div>


<script src="${basePath}/adminlte/plugins/jQuery/jQuery-2.2.0.min.js"></script>
<script src="${basePath}/adminlte/bootstrap/js/bootstrap.min.js"></script>
<script src="${basePath}/common/js/ajax.js"></script>
<script src="${basePath}/common/js/form.js"></script>
<script src="${basePath}/common/js/common.js"></script>
<script src="${basePath}/common/js/message.js"></script>
<script>
    $("#forgetPassword").click(function () {
        $("#EditEntity").find(".modal-body").load("${basePath}/function/manager/common/forgetPassword");
        $("#EditEntity").modal("show");
    })
    $("#EditEntity").find(".modal-footer button:last").click(function () {
        var param = getFormData($("#EditEntity").find("form"));
        var oThis = this;
        $(oThis).prop("disabled", true);
        AsyncPost("${basePath}/function/forgetPassword", param, function (value) {
            if (value.code != 0) {
                ErrMessage(value.msg);
            } else {
                ShowMessage(value.msg);
                $("#EditEntity").modal("hide");
            }
            $(oThis).prop("disabled", false);
        })
    })
    if (localStorage.rememberMe && localStorage.rememberMe == "1") {
        $("[name='username']").val(localStorage.username);
        $("[name='password']").val(localStorage.password);
        $("#save").prop("checked", true);
    }
    $(document).ready(function () {
        $("#login").click(function () {
            $("#login").prop("disabled", true);
            var url = "${basePath}/manager/user/login";
            var username = $("[name='username']").val();
            var password = $("[name='password']").val();
            if ($("#save").prop("checked") == true) {
                localStorage.username = username;
                localStorage.password = password;
                localStorage.rememberMe = 1;
            } else {
                localStorage.username = null;
                localStorage.password = null;
                localStorage.rememberMe = 0;
            }
            AsyncPost(url, {username: username, password: password}, function (result) {
                if (result.code == 0) {
                    window.location.href = "${basePath}/manager/user/main";
                } else {
                    $("#login").prop("disabled", false);
                    $("#error").text(result.msg);
                }
            })
        });
    });
</script>
</body>
</html>
